package com.solotiger.geographic.ui.activity;

import android.os.Bundle;
import android.support.annotation.Nullable;
import android.view.View;
import android.widget.ListView;

import com.lcodecore.tkrefreshlayout.TwinklingRefreshLayout;
import com.solotiger.geographic.R;
import com.solotiger.geographic.db.DatabaseManger;
import com.solotiger.geographic.ui.adapter.CollectAdapter;
import com.solotiger.geographic.ui.base.BaseActivity;

import butterknife.BindView;

public class CollectActivity extends BaseActivity {

    @BindView(R.id.listView)
    ListView mListView;

    @BindView(R.id.refreshLayout)
    TwinklingRefreshLayout mRefreshLayout;

    private CollectAdapter mAdapter;

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        init();
    }

    private void init() {
        setTitle("收藏");
        getToolbar().setNavigationIcon(R.drawable.back);
        setNavigationOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                finish();
            }
        });

        mRefreshLayout.setEnableLoadmore(false);
        mRefreshLayout.setEnableRefresh(false);

        mAdapter = new CollectAdapter(mContext, DatabaseManger.ME.getCollects());
        mListView.setAdapter(mAdapter);
    }

    @Override
    protected int getLayoutResId() {
        return R.layout.activity_collect;
    }
}
